/*
 * Created by zhangzxiang91@gmail.com on 2021/10/13.
 */
package com.perfma.util.model;

import lombok.Data;

import java.io.File;
import java.io.OutputStream;

/**
 * 文件下载请求
 *
 * @author zhangzxiang91@gmail.com
 * @date 2021/10/13.
 */
@Data
public class DownloadRequest {

	/**
	 * 文件Key，必传参数
	 */
	private String fileKey;

	/**
	 * 文件下载的起始位置
	 */
	private Long offset;

	/**
	 * 文件下载的长度
	 */
	private Long length;

	/**
	 * 下载文件本地保存路径，outputFile和outputStream必须且只能设置一个
	 */
	private File outputFile;

	/**
	 * 下载文件输出流，localFile和outputStream必须且只能设置一个
	 * 输出流需要调用方自己关闭
	 */
	private OutputStream outputStream;

	@Override
	public String toString() {
		return "{" + "fileKey='" + fileKey + '\'' + ", offset=" + offset + ", length=" + length + ", outputFile=" + outputFile + ", outputStream="
				+ (outputStream == null ? "null" : outputStream.getClass()) + "}";
	}

}
